import { isWxWork } from './work-weixin'
import Vue from 'vue'
import { Toast } from 'vant'

Vue.use(Toast)

if (!isWxWork()) {
  const toast = (...rest) => {
    Toast.fail({
      message: '此功能仅支持企业微信内使用'
    })
    if (typeof rest[2] === 'function') {
      rest[2]()
    }
  }

  window.wx = {
    invoke: toast,
    openEnterpriseChat: toast,
    setClipboardData: toast,
    previewImage: toast,
    previewFile: toast
  }

}
